
game:setAmbient(0.5,0.5,0.5)
game:setGravity(0.0,-9.81,0.0)

game:createAudioWithName("pirate", "media/audio/music/pirate_quiet.wav", true, 1.0, {x=0.0, y=0.0, z=0.0})
game:playAudioByName("pirate")

game:createAudioWithName("pingvin", "media/audio/music/pingvin_background.wav", true, 1.0, {x=0.0, y=0.0, z=0.0})
game:playAudioByName("pingvin")


game:createTargetControlLogic("DoNothingControlLogic",{maxForce=0, maxTorque=0},function(_)
end)

game:createActorDesc({name="SimpleBox"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=3.0,y=3.0,z=3.0}})
end)

game:createActorDesc({name="Pingvin"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=3.0,y=5.0,z=3.0}})
end)

game:createActorDesc({name="OgreCastle"},function(_)
	game:BoxShape(_,{position={x=260.0,y=30.0,z=70.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=15.0,y=40.0,z=100.0}})
	game:BoxShape(_,{position={x=-260.0,y=30.0,z=70.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=15.0,y=40.0,z=100.0}})
	game:BoxShape(_,{position={x=260.0,y=30.0,z=-45.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})
	game:BoxShape(_,{position={x=-260.0,y=30.0,z=-45.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})

	game:BoxShape(_,{position={x=170.0,y=30.0,z=-125.0},rotation={x=0.0,y=50.0,z=0.0},dimension={x=15.0,y=40.0,z=110.0}})
	game:BoxShape(_,{position={x=-170.0,y=30.0,z=-125.0},rotation={x=0.0,y=-50.0,z=0.0},dimension={x=15.0,y=40.0,z=110.0}})
	game:BoxShape(_,{position={x=75.0,y=30.0,z=-195.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})
	game:BoxShape(_,{position={x=-75.0,y=30.0,z=-195.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})

	game:BoxShape(_,{position={x=0.0,y=30.0,z=-195.0},rotation={x=0.0,y=90.0,z=0.0},dimension={x=15.0,y=40.0,z=60.0}})
end)

game:createActorDesc({name="Sword"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=2.5,y=1.0,z=12.0}})
	game:BoxShape(_,{position={x=0.0,y=0.0,z=5.5},rotation={x=0.0,y=0.0,z=0.0},dimension={x=5.0,y=1.5,z=2.0}})
end)

game:createActorDesc({name="MapElement"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=2.0,y=2.0,z=2.0}})
end)

--Talaj
game:createNode({x=0.0, y=-30, z=0.0},{x=0.0, y=0.0, z=0.0},{x=3.0, y=1.0, z=3.0},function(node,controlnode)
	game:PhysicsTerrain("Talaj",node,controlnode,{controlLogic="DoNothingControlLogic", collisionGroup=5})
end)

--OgreCastle
game:createNode({x=0.0, y=-30.0, z=-165.0},{x=0.0, y=0.0, z=0.0},{x=2, y=2, z=2},function(node,controlnode)
		game:PhysicsEntity("OgreCastle",node,controlnode,{mesh="OgreCastle.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=3000000000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="OgreCastle"},function(_)
		end)
end)

--OgreCastle
game:createNode({x=0.0, y=-30.0, z=165.0},{x=0.0, y=180.0, z=0.0},{x=2, y=2, z=2},function(node,controlnode)
		game:PhysicsEntity("OgreCastle2",node,controlnode,{mesh="OgreCastle.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=3000000000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="OgreCastle"},function(_)
		end)
end)



--Agyu
game:createNode({x=40.0, y=-30.0, z=-80.0},{x=0.0, y=0.0, z=0.0},{x=0.05, y=0.05, z=0.05},function(node,controlnode)
		game:PhysicsEntity("Agyu",node,controlnode,{mesh="Agyu.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=30000000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)

--AgyuGolyo 1-4
game:createNode({x=30.0, y=-30.0, z=-70.0},{x=0.0, y=0.0, z=0.0},{x=0.05, y=0.05, z=0.05},function(node,controlnode)
		game:PhysicsEntity("AgyuGolyo1",node,controlnode,{mesh="AgyuGolyo.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=300000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)
game:createNode({x=28.0, y=-30.0, z=-67.0},{x=0.0, y=0.0, z=0.0},{x=0.05, y=0.05, z=0.05},function(node,controlnode)
		game:PhysicsEntity("AgyuGolyo2",node,controlnode,{mesh="AgyuGolyo.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=300000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)
game:createNode({x=32.0, y=-30.0, z=-67.0},{x=0.0, y=0.0, z=0.0},{x=0.05, y=0.05, z=0.05},function(node,controlnode)
		game:PhysicsEntity("AgyuGolyo3",node,controlnode,{mesh="AgyuGolyo.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=300000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)
game:createNode({x=30.0, y=-27.3, z=-68.0},{x=0.0, y=0.0, z=0.0},{x=0.05, y=0.05, z=0.05},function(node,controlnode)
		game:PhysicsEntity("AgyuGolyo4",node,controlnode,{mesh="AgyuGolyo.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=300000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)

--Fountain
game:createNode({x=-90.0, y=-10.0, z=-90.0},{x=0.0, y=0.0, z=0.0},{x=0.07, y=0.07, z=0.07},function(node,controlnode)
		game:PhysicsEntity("Fountain",node,controlnode,{mesh="Fountain.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=300000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)

--Hordo1
game:createNode({x=100.0, y=-30.0, z=-10.0},{x=0.0, y=0.0, z=0.0},{x=0.05, y=0.05, z=0.05},function(node,controlnode)
		game:PhysicsEntity("Hordo1",node,controlnode,{mesh="Hordo1.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=300000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)

--Hordo2
game:createNode({x=100.0, y=-30.0, z=10.0},{x=0.0, y=0.0, z=0.0},{x=0.05, y=0.05, z=0.05},function(node,controlnode)
		game:PhysicsEntity("Hordo2",node,controlnode,{mesh="Hordo2.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=300000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
		end)
end)



-- Map, the base points of the curve path
Map = {
	numberOfPoints = 0

}


MapElements = {
	BaseElements = {
		numBases = 0
			},
	SpecElements = {
		numSpecs = 0
		},
	func = function(_) end
}


-- Generate the Map objects around the map base points
game:createMap("purple_nebula_skybox", {mapBasePoints = Map, resolution = 0.2, percent = 80.0, elementTypes = MapElements, maxElements = 15})





	
--game:createNode({x=0.0, y=0.0, z=-100.0},{x=0.0, y=0.0, z=0.0},{x=1, y=1, z=1},function(node,controlnode)
	--game:PhysicsEntity("body",node,controlnode,{mesh="Derins_Sword.mesh", controlLogic="PlayerBodyControlLogic",collisionGroup=99, weight=300.0,boundingBox=0.1, isStatic=false, isKinematic=true, actorDesc="_boundingBox"},function(_)
	--end)
	--game:createCamera(node,{name="mainCam"})
	--game:addNode(node,controlnode,{x=0.0, y=0.0, z=0.0},{x=0.0, y=0.0, z=0.0},{x=4.0, y=4.0, z=4.0},function(node,controlnode)
		--game:PhysicsEntity("kard",node,controlnode,{mesh="Derins_Sword.mesh", controlLogic="PlayerControlLogic",collisionGroup=1, weight=300.0, boundingBox=3.95, isStatic=false, isKinematic=true, actorDesc="Sword"},function(_)
		--end)
	--end)
--end)

game:createNode({x=0.0, y=0.0, z=-100.0},{x=0.0, y=0.0, z=0.0},{x=1, y=1, z=1},function(node,controlnode)
	game:Entity("body",node,controlnode,{controlLogic="PlayerBodyControlLogic"},function(entity)
		game:NodeBody(entity,node,{name="bodyNode"},function(body)
				game:setMasterBody(entity,body)
		end)
	end)
	game:createCamera(node,{name="mainCam"})
	game:addNode(node,controlnode,{x=0.0, y=0.0, z=0.0},{x=0.0, y=0.0, z=0.0},{x=4.0, y=4.0, z=4.0},function(node,controlnode)
		game:Entity("kard",node,controlnode,{controlLogic="PlayerControlLogic"},function(entity)
			game:PhysicsBody(entity,node, {collisionGroup=1, weight=300.0, boundingBox=3.95, isStatic=false, isKinematic=true,disableGravity=true, actorDesc="Sword"},function(body)end) 
			game:OgreBody(entity,node, {mesh="Derins_Sword.mesh"}, function(body)
				game:setMasterBody(entity,body)
			end)
		end)
	end)
end)

game:createTargetControlLogic("PingvinControlLogic",{maxForce=5000, maxTorque=0.01},function(_)
	game:Target(_,{position={x=150,y=-20,z=-150},proximityRadius=10, name=""})
	game:Target(_,{position={x=150,y=-20,z=150},proximityRadius=10, name=""})
	game:Target(_,{position={x=-150,y=-20,z=150},proximityRadius=10, name=""})
	game:Target(_,{position={x=-150,y=-20,z=-250},proximityRadius=10, name=""})
end)

game:createNode({x=0.0, y=50.0, z=0.0},{x=90.0, y=0.0, z=0.0},{x=10.3, y=10.3, z=10.3},function(node,controlnode)
	game:PhysicsEntity("Pingvin",node,controlnode,{mesh="robot.mesh", controlLogic="DoNothingControlLogic",collisionGroup=2, weight=60000.0, boundingBox=3.0, isStatic=false, isKinematic=false, actorDesc="Pingvin"},function(_)
		game:addHUD(_)
		game:addTrigger(_,function(_)
			game:ExplodeAction(_)
			game:KilledReq(_)
			game:PSysAction(_,{script="explode"})
			game:GameOverAction(_)
			game:CustomScriptAction(_,function()
				game:playAudioFromFile("media/audio/sound/Suicide_Bomber_2.wav", false, 1.0, {x=0.0, y=0.0, z=0.0})
				game:createAudioWithName("fire", "media/audio/sound/Fire_Burning.wav", true, 1.0, {x=0.0, y=0.0, z=0.0})
				game:playAudioByName("fire")
				game:setWindowVisible("GameOverWindow",true)
				game:setCursorVisible(true)
				end)
		end)
	end)
end)

game:createTargetControlLogic("TargetControlLogic1",{maxForce=5000, maxTorque=0.01},function(_)
	--game:Target(_,{position={x=0,y=0,z=0},proximityRadius=10, name="kard"})
	game:Target(_,{position={x=-30,y=150,z=-200},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=150,z=-300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=70,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=60,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=0,z=-300},proximityRadius=10, name=""})
	game:Launcher(_,{mesh="MeatBall.mesh",position={x=0,y=20,z=0},velocity={x=600,y=600,z=600},cooldown=5})
	game:ProjectileTarget(_,{position={x=0,y=-20,z=0},proximityRadius=10, name="Pingvin"})
end)

game:createTargetControlLogic("TargetControlLogic2",{maxForce=50000, maxTorque=0.01},function(_)
	game:Target(_,{position={x=30,y=150,z=-200},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=150,z=-300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=-20,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=-20,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=-20,z=-300},proximityRadius=10, name=""})
	--game:Target(_,{position={x=-100,y=-20,z=-300},proximityRadius=10, name=""})
	game:Launcher(_,{mesh="MeatBall.mesh",position={x=0,y=20,z=0},velocity={x=3000000,y=3000000,z=3000000},cooldown=8})
	game:ProjectileTarget(_,{position={x=0,y=-20,z=0},proximityRadius=10, name="Pingvin"})
end)

game:createTargetControlLogic("TargetControlLogic3",{maxForce=50000, maxTorque=0.01},function(_)
	game:Target(_,{position={x=0,y=200,z=-200},proximityRadius=10, name=""})
	game:Target(_,{position={x=0,y=100,z=250},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=100,z=-250},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=100,z=-250},proximityRadius=10, name=""})
	--game:Target(_,{position={x=-100,y=200,z=-300},proximityRadius=10, name=""})
	game:Launcher(_,{mesh="MeatBall.mesh",position={x=0,y=20,z=0},velocity={x=600000,y=600000,z=600000},cooldown=6})
	game:ProjectileTarget(_,{position={x=0,y=-20,z=0},proximityRadius=10, name="Pingvin"})

end)




--game:createNode({x=100,y=20,z=-500},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	--game:PhysicsEntity("Entitas",node,controlnode,{mesh="Mutagon_Kornel.mesh", controlLogic="TargetControlLogic",collisionGroupFilter="ENEMY", weight=3.0, boundingBox=0.95, actorDesc="SimpleBox"},function(_)end)
	--game:addNode(node,controlnode,{x=0.0, y=0.0, z=-30.0},{x=0.0, y=90.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	--	game:StaticEntity(node,{name="Misi",mesh="Mutagon_Misi.mesh"})
	--end)
--end)


--game:createTargetControlLogic("TargetControlLogic2",{maxForce=3000, maxTorque=0.01},function(_)
	--game:Target(_,{position={x=0,y=0,z=0},{x=0.0, y=0.0, z=0.0},proximityRadius=10, name="Entitas"})
--end)

--game:createNode({x=-30,y=150,z=-800},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	--game:PhysicsEntity("Kornel",node,controlnode,{mesh="Mutagon_Kornel.mesh", controlLogic="TargetControlLogic1",collisionGroup=4, weight=3.0, boundingBox=3.0, isStatic=false, isKinematic=false, actorDesc="SimpleBox"},function(_)end)
--end)

game:createNode({x=-30,y=150,z=-800},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	game:Entity("Kornel",node,controlnode,{controlLogic="TargetControlLogic1"},function(entity)
		game:PhysicsBody(entity,node, {collisionGroup=4, weight=3.0, boundingBox=3.0, isStatic=false, isKinematic=false,disableGravity=true, actorDesc="SimpleBox"},function(body)
			game:setMasterBody(entity,body)
		end) 
		game:OgreBody(entity,node, {mesh="Mutagon_Kornel.mesh"}, function(_)end)
	end)
end)

game:createNode({x=30,y=150,z=-800},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	game:Entity("Misi",node,controlnode,{controlLogic="TargetControlLogic2"},function(entity)
		game:PhysicsBody(entity,node, {collisionGroup=4, weight=3.0, boundingBox=3.0, isStatic=false, isKinematic=false,disableGravity=true, actorDesc="SimpleBox"},function(body)
			game:setMasterBody(entity,body)
		end) 
		game:OgreBody(entity,node, {mesh="Mutagon_Misi.mesh"}, function(_)end)
	end)
end)

game:createNode({x=-0,y=200,z=-800},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	game:Entity("Vnicz",node,controlnode,{controlLogic="TargetControlLogic3"},function(entity)
		game:PhysicsBody(entity,node, {collisionGroup=4, weight=3.0, boundingBox=3.0, isStatic=false, isKinematic=false,disableGravity=true, actorDesc="SimpleBox"},function(body)
			game:setMasterBody(entity,body)
		end) 
		game:OgreBody(entity,node, {mesh="Mutagon_Vinicz.mesh"}, function(_)end)
	end)
end)


--game:createNode({x=30,y=150,z=-800},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	--game:PhysicsEntity("Vinicz",node,controlnode,{mesh="Mutagon_Vinicz.mesh", controlLogic="TargetControlLogic2",collisionGroup=4, weight=3.0, boundingBox=3.0, isStatic=false, isKinematic=false, actorDesc="SimpleBox"},function(_)end)
--end)

--game:createNode({x=-0,y=200,z=-800},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	--game:PhysicsEntity("Misi",node,controlnode,{mesh="Mutagon_Misi.mesh", controlLogic="TargetControlLogic3",collisionGroup=4, weight=3.0, boundingBox=3.0, isStatic=false, isKinematic=false, actorDesc="SimpleBox"},function(_)end)
--end)


game:setRoundCamera({position={x=0.0, y=0.0, z=0.0}, height=100, radius=50, target="Pingvin"})